package com.chao.yyks.modular.ranking.controller;

import com.alibaba.fastjson.JSONObject;
import com.chao.common.util.log.Inter;
import com.chao.common.util.reaction.PageList;
import com.chao.yyks.modular.ranking.bean.EnRanking;
import com.chao.yyks.modular.ranking.bean.EnRankingLabel;
import com.chao.yyks.modular.ranking.service.EnRankingLabelService;
import com.chao.yyks.modular.ranking.service.EnRankingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.List;


/**
 * 学生排名Controller
 * chao
 * 2024-09-15
 */
@RestController
@RequestMapping("/enRanking")
public class EnRankingController {

	/**
	 * 学生排名Service
	 */
	@Autowired
	private EnRankingService enRankingService;

	/**
	 * 学生板块排名Service
	 */
	@Autowired
	private EnRankingLabelService enRankingLabelService;

	/**
	 * 新增学生阅读篇数
	 */
	@Inter("ERL_ADD_01")
	@RequestMapping(method = RequestMethod.POST, value = "insertEnRankingLabel")
	public void insertEnRankingLabel(@RequestBody EnRankingLabel enRankingLabel){
		enRankingLabelService.insertEnRankingLabel(enRankingLabel);
	}

	/**
	 * 新增学生听力时长
	 */
	@Inter("ERG_ADD_01")
	@RequestMapping(method = RequestMethod.POST, value = "insertEnRanking")
	public void insertEnRanking(@RequestBody EnRanking enRanking){
		enRankingService.insertEnRanking(enRanking);
	}

	/**
	 * 查询学生报告
	 */
	@Inter("ERG_SEL_01")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnRankingByStudentId")
	public JSONObject selectEnRankingByStudentId(String studentId){
		return enRankingService.selectEnRankingByStudentId(studentId);
	}

	/**
	 * 查询学生排名列表
	 */
	@Inter("ERG_SEL_02")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnRankingByList")
	public PageList<EnRanking> selectEnRankingByList(@RequestParam Map<String,Object> map){
		return enRankingService.selectEnRankingByList(new JSONObject(map));
	}

	/**
	 * 分页查询学生排名列表
	 */
	@Inter("ERG_SEL_03")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnRankingByPage")
	public PageList<EnRanking> selectEnRankingByPage(@RequestParam Map<String,Object> map){
		return enRankingService.selectEnRankingByPage(new JSONObject(map));
	}

	/**
	 * 查询得分学生排名
	 */
	@Inter("ERG_SEL_04")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnRankingScore")
	public List<EnRanking> selectEnRankingScore(@RequestParam Map<String,Object> map){
		return enRankingService.selectEnRankingScore(new JSONObject(map));
	}

	/**
	 * 查询得分学生排名
	 */
	@Inter("ERG_SEL_05")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnRankingAllScore")
	public List<EnRanking> selectEnRankingAllScore(@RequestParam Map<String,Object> map){
		return enRankingService.selectEnRankingAllScore(new JSONObject(map));
	}

	/**
	 * 查询听力时长学生排名
	 */
	@Inter("ERG_SEL_06")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnRankingDuration")
	public List<EnRanking> selectEnRankingDuration(@RequestParam Map<String,Object> map){
		return enRankingService.selectEnRankingDuration(new JSONObject(map));
	}

	/**
	 * 查询听力时长学生排名
	 */
	@Inter("ERG_SEL_08")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnRankingType")
	public List<EnRanking> selectEnRankingType(@RequestParam Map<String,Object> map){
		return enRankingService.selectEnRankingType(new JSONObject(map));
	}

	/**
	 * 查询阅读篇数学生排名
	 */
	@Inter("ERG_SEL_07")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnRankingLength")
	public List<EnRankingLabel> selectEnRankingLength(@RequestParam Map<String,Object> map){
		return enRankingLabelService.selectEnRankingLength(new JSONObject(map));
	}

}